package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.PageResult;
import com.itheima.entity.Result;
import com.itheima.service.OrderSettingListService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/orderSettingList")
public class OrderSettingListController {

    @Reference
    private OrderSettingListService orderSettingListService;

    @RequestMapping("/findPage")
    public PageResult findPage(@RequestBody Map map) {
        PageResult pageResult = orderSettingListService.pageQuery(map);
        return pageResult;
    }
    @RequestMapping("/changeOrderStatus")
    public Result changeOrderStatus (Integer id){
        try {
            orderSettingListService.setStatus(id);
            return new Result(true,"成功");
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,"失败");
        }
    }

}
